<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>全局组件案例1</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="app1" style="background-color: red;">
        <helloworld></helloworld>
        <helloworld></helloworld>
        <helloworld></helloworld>
    </div>
    <div id="app2" style="background-color:green;">
        <helloworld></helloworld>
    </div>
</body>
</html>
<script>
    //定义全局组件
    Vue.component('helloworld',{
        template:'<h1>{{msg}}</h1>',
        data:function(){
            return{
                msg:'HelloWorld'
            }
        }
    });
    var vm=new Vue({
        el:'#app1'
    });
    var vm=new Vue({
        el:'#app2'
    });
</script>